#include <iostream>
using namespace std;
#include <sys/types.h>
#include <unistd.h>

int main()
{
    /* 得到当前进程的进程号 */
    pid_t pid = getpid();
    cout << "pid:" << pid << endl;

    /*得到当前进程父进程的ID号*/
    pid_t ppid = getppid();
    cout << "ppid:" << ppid << endl;

    while (1)
    {
        sleep(1);
    }

    return 0;
}